package cn.xueden.common.core.context;

import lombok.Data;

@Data
public class ContextHolder {

    private static final InheritableThreadLocal<RequestContext> ctx=new InheritableThreadLocal<>();


    public static void set(RequestContext requestContext){
        if (requestContext != null) {
            ctx.set(requestContext);
        } else {
            remove();
        }
    }

    public static RequestContext get(){
        return ctx.get();
    }


    public static void remove(){
        ctx.remove();;
    }

}
